﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Mvc;

namespace Wjs.Controllers
{
    public class FormLoaderController : Controller
    {
        //
        // GET: /FormLoader/

        public ActionResult Index(int id)
        {
            Thread.Sleep(3000); // Simulate delay

            if (id == 123)
            {
                return Json(new
                {
                    Id = id,
                    color = 2,
                    fruit = 4,
                    name = "Sarah G",
                    date = "5/25/2002",
                    email = "11111111112222222222333334",
                    category = "melon"
                },
                JsonRequestBehavior.AllowGet);
            }

            return Json(new
            {
                Id = id,
                color = 4,
                fruit = 3,
                name = "John Doe",
                date = "10/9/2004",
                email = "jdoe@gmail.com",
                category = "citrus"
            },
            JsonRequestBehavior.AllowGet);
        }

    }
}
